package com.youpingou.controller;

import com.youpingou.domain.Category;
import com.youpingou.service.CategoryService;
import com.youpingou.vo.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/categorys")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public BaseResult findAll(){
        //1 查询
        List<Category> list = categoryService.findAll();
        //2 封装
        return BaseResult.ok("查询成功" , list );
    }

}